//
//  CachetDetailCell.m
//  云律司
//
//  Created by 韦淋 on 2017/9/14.
//  Copyright © 2017年 test. All rights reserved.
//

#import "CachetDetailCell.h"

@implementation CachetDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initalizeInterface];
    }
    return self;
}
- (void)initalizeInterface{
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.lineView];
    [self.bgView addSubview:self.titleLable];
    [self.bgView addSubview:self.receiveLable];
    [self.bgView addSubview:self.documentType];
    [self.bgView addSubview:self.approveState];
    [self.bgView addSubview:self.checkPicButton];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.bgView.frame = CGRectMake(5, 0, self.contentView.bounds.size.width - 10, self.contentView.bounds.size.height - 15);
    self.lineView.frame = CGRectMake(0, 0, self.bgView.bounds.size.width , 2);
    self.titleLable.frame = CGRectMake(10, 0, 300, 40);
    self.receiveLable.frame = CGRectMake(40, 40, 350, 25);
    self.documentType.frame = CGRectMake(40, 65, 350, 25);
    self.approveState.frame = CGRectMake(40, 90, 350, 25);
    self.checkPicButton.frame = CGRectMake(220, 120, 120, 25);
    for (int i = 0; i < 3; i ++) {
        UIView *dividerView = [[UIView alloc] initWithFrame:CGRectMake(0, 40 + i * 25, self.bgView.bounds.size.width , 0.5)];
        dividerView.backgroundColor = [UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:238.0f/255.0f alpha:1.0f];
        [self.bgView addSubview:dividerView];
        
        NSArray *array = [NSArray array];
        array = @[@"bann_02",@"bann_03",@"bann_04"];
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 42 + i * 25, 20, 20)];
        imageView.image = [UIImage imageNamed:array[i]];
        
        [self.bgView addSubview:imageView];
    }
    
    
}
//按钮方法
-(void)action_CheckPic:(UIButton*)sender
{
    if ([self.delegate respondsToSelector:@selector(didCheckPicButtonAction:)]) {
        [self.delegate didCheckPicButtonAction:sender];
    }
}

- (UIView *)bgView{
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];
        _bgView.layer.shadowColor=[UIColor lightGrayColor].CGColor;
        _bgView.layer.shadowOffset=CGSizeMake(3, 3);
        _bgView.layer.shadowOpacity=0.5;
    }
    return _bgView;
}
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor colorWithRed:63.0f/255.0f green:189.0f/255.0f blue:240.0f/255.0f alpha:1.0f];
    }
    return _lineView;
}
- (UILabel *)titleLable{
    if (!_titleLable) {
        _titleLable = [[UILabel alloc]init];
        _titleLable.textColor = [UIColor blackColor];
        _titleLable.font = [UIFont systemFontOfSize:16];
    }
    return _titleLable;
}


- (UILabel *)receiveLable{
    if (!_receiveLable) {
        _receiveLable = [[UILabel alloc]init];
        _receiveLable.textColor = [UIColor blackColor];
        _receiveLable.font = [UIFont systemFontOfSize:11];
        
    }
    return _receiveLable;
}
- (UILabel *)documentType{
    if (!_documentType) {
        _documentType = [[UILabel alloc]init];
        _documentType.textColor = [UIColor blackColor];
        _documentType.font = [UIFont systemFontOfSize:11];
    }
    return _documentType;
}
- (UILabel *)approveState{
    if (!_approveState) {
        _approveState = [[UILabel alloc]init];
        _approveState.textColor = [UIColor blackColor];
        _approveState.font = [UIFont systemFontOfSize:11];
    }
    return _approveState;
}

- (UIButton *)checkPicButton{
    if (!_checkPicButton) {
        _checkPicButton = [[UIButton alloc]init];
        [_checkPicButton setTitle:@"查看盖章图片" forState:0];
        _checkPicButton.layer.masksToBounds = YES;
        _checkPicButton.layer.cornerRadius = 5;
        _checkPicButton.backgroundColor = [UIColor colorWithRed:33.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0f];
        [_checkPicButton addTarget:self action:@selector(action_CheckPic:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _checkPicButton;
}

@end
